package problem495;

//495.提莫攻击
//https://leetcode.cn/problems/teemo-attacking/description/

class Solution {
    public int findPoisonedDuration(int[] timeSeries, int duration) {
        int n = timeSeries.length;
        int ret = 0;
        int x = 0;
        for(int i = 0; i<n-1; i++) {
            if(timeSeries[i] + duration -1 < timeSeries[i+1]) ret += duration;
            else ret += timeSeries[i+1] - timeSeries[i];
        }
        ret += duration;
        return ret;
    }
}